home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / LABS.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  349 b   |  18 lines

  1. /* labs.c function, from p.217 of turbo c bible */
  2. #include<stdio.h>
  3. #include<stdlib.h>
  4. main(int argc, char **argv)
  5. {
  6.     long value , result;
  7.  
  8.     if(argc < 2)
  9.     {
  10.         printf("Usage: <long_integer_value>\n",argv[0]);
  11.     }
  12.     else
  13.     {
  14.         value = atol(argv[1]);
  15.         result = labs(value);
  16.         printf("Absolute value of %ld = %d\n", value, result);
  17.     }
  18. }